<link rel="stylesheet" href="/assets/libs/editormd/css/editormd.css"/>
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-row">
        <input type="hidden" id="admin_id" value="{$model.admin_id ?? ''}" required autocomplete="off"
               class="layui-input" readonly>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
            <div class="layui-form-item">
                <label class="layui-form-label">休假人1</label>
                <div class="layui-input-block">
                    <input type="text" value="{$model.username ?? ''}" required
                           placeholder="请输入{$model.alternative_title??'休假'}"
                           autocomplete="off"
                           class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
            <div class="layui-form-item">
                <label class="layui-form-label">部门</label>
                <div class="layui-input-block">
                    <input type="text" value="{$model.group_name}" required
                           placeholder="请输入项目名称"
                           autocomplete="off"
                           class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
            <div class="layui-form-item">
                <label class="layui-form-label">休假类型</label>
                <div class="layui-input-block">
                    <input type="text" value="{$model.alternative_title??'休假'}" required
                           placeholder="请输入休假类型"
                           autocomplete="off"
                           class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
            <div class="layui-form-item">
                <label class="layui-form-label">颜色标记</label>
                <div class="layui-input-block">
                    <div class="layui-input-block" style="margin:0px!important;">
                        <div class="layui-input-inline" style="margin:0px!important;">
                            <input type="text" name="color" lay-verify="required" value="{$model.color ??''}" placeholder="请选择颜色"
                                   class="layui-input" id="test-form-input" >
                        </div>
                        <div class="layui-inline">
                            <div id="test-form"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
            <div class="layui-form-item">
                <label class="layui-form-label">时间范围</label>

                <div class="layui-input-block">
                    <div class="layui-input-inline">
                        <input type="text" name="start_time" id="start_time" value="{$model.start_time ??''}" required
                               placeholder="请输入开始时间"
                               autocomplete="off"
                               class="layui-input" readonly>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="end_time" id="end_time" value="{$model.end_time ??''}" required
                               placeholder="请输入结束时间"
                               autocomplete="off"
                               class="layui-input" readonly>
                    </div>
                </div>
            </div>
        </div>
        {if $model.alternative_title eq '调休'}
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12" id="dy_time">
            <!--            <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">-->
            <!--                <div class="layui-form-item">-->
            <!--                    <label class="layui-form-label">对应加班单</label>-->
            <!--                    <div class="layui-input-block">-->
            <!--                        <div id="demo1" class="xm-select-demo"></div>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--            </div>-->
            <div class="layui-form-item">
                <label class="layui-form-label">对应时间</label>

                <div class="layui-input-block">
                    <div id="demo1" class="xm-select-demo"></div>
<!--                    <input type="text" name="corresponding" id="corresponding"  value="{$model.corresponding ??''}"  required-->
<!--                           placeholder="请输入对应结束时间"-->
<!--                           autocomplete="off"-->
<!--                           class="layui-input">-->
                </div>
            </div>
        </div>
        {/if}
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
            <div class="layui-form-item">
                {if $model.alternative_title eq '调休'}
                <label class="layui-form-label">小时数</label>
                {else}
                <label class="layui-form-label">天数</label>
                {/if}
                <div class="layui-input-block">
                    <input type="text" placeholder="请输入请假天数" name="day" class="layui-input" value="{$model.day ?? ''}">
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
            <div class="layui-form-item">
                <label class="layui-form-label">请假事由</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入请假事由" name="remark" class="layui-textarea">{$model.remark ?? ''}</textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>

<script src="/static/admin/layui/layui.js"></script>
<script src="/static/xm-select.js"></script>
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        treeTable: '../admin/lib/extend/authtree'
    }).use(['index', 'form', 'laydate', 'colorpicker'], function () {
        var $ = layui.$, form = layui.form, laydate = layui.laydate;
        var admin_id = $('#admin_id').val();
        //日期范围
        laydate.render({
            elem: '#start_time'
            , type: 'datetime'
            , format: "yyyy-MM-dd HH:mm"
            , trigger: 'click'//呼出事件改成click

        });
        //日期范围
        laydate.render({
            elem: '#end_time'
            , type: 'datetime'
            , format: "yyyy-MM-dd HH:mm"
            , trigger: 'click'//呼出事件改成click
        });
        $.ajax({
            url: "{:url('overtime/treeList')}",
            type: 'post',
            data:{ids:'xq',user_id:admin_id},
            dataType: 'json',
            success: function (res) {
                console.log(res)
                xmSelect.render({
                    el: '#demo1',
                    name: 'corresponding',
                    direction: 'auto',
                    initValue: [{$model.corresponding}],
                    data: res
                })
            }
        })

    });
</script>
